#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

void test_vector1()
{
	vector<int> v1;
	for (int i = 0; i < 10; i++)
	{
		v1.push_back(i);
		cout << v1.capacity() << endl;
	}
	cout << endl;

	vector<int>::iterator it = v1.begin();
	while (it != v1.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test_vector2()
{
	vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	cout << v.size() << endl;

	v.resize(8, 9);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	cout << v.capacity() << endl;

	v.reserve(15);

	cout << v.capacity() << endl;
}

void test_vector3()
{
	vector<int> v;
	for (int i = 0; i < 5; i++)
	{
		v.push_back(i);
	}

	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	cout << v[1] << " " << v[3] << endl;

	cout << v.at(1) << " " << v.at(0) << endl;

	cout << v.front() << " " << v.back() << endl;

	int* ptr = v.data();
	cout << *ptr << endl;
	++ptr;
	cout << *ptr << endl;
}

int main()
{
	test_vector3();


	return 0;
}